package com.shujia.flink.tf;

import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.util.Collector;

public class FlatMapFun implements FlatMapFunction<String, String> {
    /**
     * flatMap方法每一条数据执行一次
     *
     * @param value 一行数据
     * @param out   用于将数据发送到下游
     */
    @Override
    public void flatMap(String value, Collector<String> out) throws Exception {
        for (String word : value.split(",")) {
            //将数据发送到下游
            out.collect(word);
        }
    }
}